<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加动态测点</title>
    <meta name="context-path" th:content="@{/}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/bootstrap-responsive.min.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/colorpicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/datepicker.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/uniform.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/select2.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-style.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-media.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/css/matrix-full.css}"/>
    <link rel="stylesheet" th:href="@{/resources/matrix/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" th:href="@{/resources/valid/css/bootstrapValidator.css}"/>
    <link rel="stylesheet" th:href="@{/resources/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/resources/css/website.css}"/>
</head>
<body class="childbody" style="overflow-y:scroll;">
<div class="container-fluid editform_fluid" xmlns:th="http://www.thymeleaf.org">
    <!--Chart-box-->
    <form id="detailform" class="form-horizontal">
        <div class="row-fluid">
            <div class="span6">
                <div class="widget-box">
                    <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                        <h5>基本参数</h5>
                    </div>
                    <div class="widget-content">
                        <input type="hidden" id="parentId" name="parentId" th:value="${parentId}"/>
                        <input type="hidden" id="eigenValues" name="eigenValues"/>
                        <div class="control-group">
                            <label class="control-label">名称 :</label>
                            <div class="controls  form-group">
                                <input type="text" name="name" class="span11 form-control" placeholder="请输入名称">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">编码：</label>
                            <div class="controls form-group">
                                <input type="text" name="code" class="span11 form-control" placeholder="请输入编码">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">关联测点编码：</label>
                            <div class="controls form-group">
                                <input type="text" name="relationCode" class="span11 form-control"
                                       placeholder="请输入关联测点编码">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">类别：</label>
                            <div class="controls form-group">
                                <select id="cbbCategory" class="span11 form-control" name="category">
                                    <option value="">---请选择---</option>
                                    <option th:each="cate : ${categorys}" th:value="${cate.id}"
                                            th:text="${cate.name}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">图片：</label>
                            <div class="controls form-group">
                                <table style="width: 100%">
                                    <tr>
                                        <td width="50%">
                                            <div style="position:relative">
                                                <img id="imgAlt1" class="cover-radius"
                                                     width="100%" style="cursor: pointer;height:150px;"/>
                                                <input id="image1" name="image1" type="hidden"/>
                                                <input id="fileInput_image1" name="file" type="file"
                                                       style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0; cursor: pointer;"/>
                                                <small class="help-block cover-tips"
                                                       style="color: #dd4b39;display: none;">
                                                    请上传照片
                                                </small>
                                            </div>
                                        </td>
                                        <td width="50%">
                                            <div style="position:relative">
                                                <img id="imgAlt2" class="cover-radius"
                                                     width="100%" style="cursor: pointer;height:150px;"/>
                                                <input id="image2" name="image2" type="hidden"/>
                                                <input id="fileInput_image2" name="file" type="file"
                                                       style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0; cursor: pointer;"/>
                                                <small class="help-block cover-tips"
                                                       style="color: #dd4b39;display: none;">
                                                    请上传照片
                                                </small>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="50%">
                                            <div style="position:relative">
                                                <img id="imgAlt3" class="cover-radius"
                                                     width="100%" style="cursor: pointer;height:150px;"/>
                                                <input id="image3" name="image3" type="hidden"/>
                                                <input id="fileInput_image3" name="file" type="file"
                                                       style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0; cursor: pointer;"/>
                                                <small class="help-block cover-tips"
                                                       style="color: #dd4b39;display: none;">
                                                    请上传照片
                                                </small>
                                            </div>
                                        </td>
                                        <td width="50%">
                                            <div style="position:relative">
                                                <img id="imgAlt4" class="cover-radius"
                                                     width="100%" style="cursor: pointer;height:150px;"/>
                                                <input id="image4" name="image4" type="hidden"/>
                                                <input id="fileInput_image4" name="file" type="file"
                                                       style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0; cursor: pointer;"/>
                                                <small class="help-block cover-tips"
                                                       style="color: #dd4b39;display: none;">
                                                    请上传照片
                                                </small>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">经度：</label>
                            <div class="controls form-group">
                                <input type="text" name="longitude" class="span11 form-control" placeholder="请输入经度">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">纬度：</label>
                            <div class="controls form-group">
                                <input type="text" name="latitude" class="span11 form-control" placeholder="请输入纬度">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">描述：</label>
                            <div class="controls form-group">
                                <textarea class="span11 form-control" name="description"></textarea>
                            </div>
                        </div>
                        <div id="myCategories">

                        </div>
                    </div>
                </div>
            </div>
            <div class="span6">
                <div class="widget-box">
                    <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                        <h5>计算参数</h5>
                    </div>
                    <div class="widget-content">
                        <div class="control-group">
                            <label class="control-label">单位：</label>
                            <div class="controls form-group">
                                <select class="span11 form-control" name="unit">
                                    <option value="-1">---请选择---</option>
                                    <option th:each="ut : ${units}" th:value="${ut.value}"
                                            th:text="${ut.name}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">采样频率：</label>
                            <div class="controls form-group">
                                <select class="span11 form-control" name="frequency">
                                    <option value="-1">---请选择---</option>
                                    <option th:each="fq : ${frequences}" th:value="${fq.value}"
                                            th:text="${fq.name}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">分析点数：</label>
                            <div class="controls form-group">
                                <select class="span11 form-control" name="dataCount">
                                    <option value="-1">---请选择---</option>
                                    <option th:each="dc : ${dataCounts}" th:value="${dc.value}"
                                            th:text="${dc.name}"></option>
                                </select>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">采样方式：</label>
                            <div class="controls form-group">
                                <input type="radio" name="sampleType" th:each="st,st_status : ${sampleTypes}"
                                       th:value="${st.value}"
                                       th:text="${st.name}" th:checked="${st_status.index == 0}"/>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">采样时长：</label>
                            <div class="controls form-group">
                                <input type="text" name="samplePeriod" class="span11 form-control"
                                       placeholder="请输入采样时长">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">采样间隔：</label>
                            <div class="controls form-group">
                                <input type="text" name="sampleInterval" class="span11 form-control"
                                       placeholder="请输入采样间隔">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">触发量级：</label>
                            <div class="controls form-group">
                                <input type="text" name="triggerLevel" class="span11 form-control"
                                       placeholder="请输入触发量级">
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label">触发延迟时间：</label>
                            <div class="controls form-group">
                                <input type="text" name="triggerDelay" class="span11 form-control"
                                       placeholder="请输入触发延迟时间">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="widget-box">
                <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                    <h5>设置特征值</h5>
                </div>
                <div class="widget-content nopadding">
                    <div class="table_actions">
                        <button id="btnAddEigenValues" type="button" class="btn btn-primary">添加</button>
                        <button id="btnDeleteEigenValues" type="button" class="btn btn-danger">删除</button>
                    </div>
                    <table class="layui-hide" id="eigenValueTable" lay-filter="eigenValueTable"></table>
                </div>
            </div>
        </div>
        <div class="form-actions" style="background-color:inherit;margin-bottom: 40px;">
            <button id="btnSubmit" type="button" class="btn btn-success">确定</button>
            <button id="btnClose" type="button" class="btn btn-primary">关闭</button>
        </div>
        <div style="position:absolute;left:-99999999px;">
            <div id="eigenValueAll" class="row-fluid" style="margin:10px auto;width:650px;height:320px;">
                <div class="widget-box">
                    <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                        <h5>选择特征值</h5>
                    </div>
                    <div class="widget-content nopadding">
                        <table class="layui-hide" id="eigenValueAllTable"></table>
                    </div>
                </div>
            </div>
        </div>
        <div style="position:absolute;left:-99999999px;">
            <div id="alarmSetting" class="row-fluid" style="margin:10px auto;width:650px;height:320px;">
                <div>
                    <div class="widget-box">
                        <div class="widget-title"><span class="icon"> <i class="icon-align-justify"></i> </span>
                            <h5>设置报警值</h5>
                        </div>
                        <div class="widget-content">
                            <div class="control-group">
                                <label class="control-label">基准值：</label>
                                <div class="controls form-group">
                                    <input type="text" id="eigen_item_baseline" name="baseline"
                                           class="span11 form-control alarm-control"
                                           placeholder="请输入基准值">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">报警类别：</label>
                                <div class="controls form-group">
                                    <select id="eigen_item_alarmType" class="span11 form-control alarm-select"
                                            name="alarmType">
                                        <option th:each="cate,cate_status : ${alarmTypes}" th:value="${cate.value}"
                                                th:text="${cate.name}"
                                                th:selected="${cate_status.index == 0}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="alarm_2 alarm_3 alarm_div">
                                <div class="control-group">
                                    <label class="control-label">预警：</label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_warning" name="warning"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入值">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">危险：</label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_danger" name="danger"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入值">
                                    </div>
                                </div>
                            </div>
                            <div class="alarm_4 alarm_5 alarm_div">
                                <div class="control-group">
                                    <label class="control-label">预警：</label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_warning1" name="warning1"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入预警值1">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"></label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_warning2" name="warning2"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入预警值2">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">危险：</label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_danger1" name="danger1"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入危险值1">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"></label>
                                    <div class="controls form-group">
                                        <input type="text" id="eigen_item_danger2" name="danger2"
                                               class="span11 form-control alarm-control"
                                               placeholder="请输入危险值2">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<script th:src="@{/resources/js/jquery.min.js}"></script>
<script th:src="@{/resources/js/jquery-migrate-1.2.1.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.ui.custom.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap.min.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap-colorpicker.js}"></script>
<script th:src="@{/resources/matrix/js/bootstrap-datepicker.js}"></script>
<script th:src="@{/resources/matrix/js/masked.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.uniform.js}"></script>
<script th:src="@{/resources/matrix/js/select2.min.js}"></script>
<script th:src="@{/resources/matrix/js/matrix.js}"></script>
<script th:src="@{/resources/matrix/js/jquery.peity.min.js}"></script>
<script th:src="@{/resources/layui/layui.all.js}" charset="utf-8"></script>
<script th:src="@{/resources/valid/js/bootstrapValidator.js}"></script>
<script th:src="@{/resources/valid/js/language/zh_CN.js}"></script>
<script th:src="@{/resources/js/website.js}"></script>
<script th:src="@{/resources/js/system.js}"></script>
<script th:src="@{/resources/js/validation_fields.js}"></script>
<script th:src="@{/resources/js/monitor/monitor_tree.js}"></script>
<script th:src="@{/resources/js/monitor/monitor_tree_common.js}"></script>
<script th:src="@{/resources/js/monitor/monitor_tree_operator.js}"></script>
<script th:src="@{/resources/js/monitor/eigenvalue_operation.js}"></script>
<script th:src="@{/resources/uploader/AjaxFileUpload/ajaxfileupload.js}"></script>
<script th:src="@{/resources/js/upload.js}"></script>
<script th:inline="javascript">
    /*<![CDATA[*/
    layui.use(['form', 'layer', 'table'], function () {
        var data = JSON.parse([[${eigenValues}]]);
        var selectedData = [];

        var table = layui.table;
        var formAdd = new TreeFormAdd(layui.form, layui.layer, parent.addDynamicPoint, {
            url: contextRoot + "dynamicPoint/doAddDynamicPoint",
            getData: function () {
                $("#eigenValues").val(JSON.stringify(selectedData));
                return $("#detailform").serializeArray();
            }
        }, "detailform", ValidFields.Device);
        $("#btnSubmit").bind("click", function (event) {
            formAdd.submit();
        });
        $("#btnAddEigenValues").bind("click", function (event) {
            showEigenValueDialog();
        });

        $("#btnDeleteEigenValues").bind("click", function (event) {
            deleteSelectedEigenValues();
        });

        $("#btnClose").bind("click", function (event) {
            formAdd.close();
        });
        $('#cbbCategory').on('change', function () {
            if ($(this).val()) {
                var val = $(this).val();
                loadCategories("myCategories", "dynamicPoint", val);
            }
        });

        for (var i = 1; i < 5; i++) {
            new ImageFileUpload(null, "fileInput_image" + i, "imgAlt" + i, "image" + i);
        }

        //全屏数据表格宽度问题
        setTimeout(function () {
            initTable(table, data, selectedData);
        }, 100);
    });
    /*]]>*/
</script>
<script type="text/html" id="eigenBar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">报警设置</a>
</script>
</body>
</html>